Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(custom-resources): add optional logging flag to AwsCustomResourceProps #29596

Closed
wants to merge 44 commits into from

Conversation

colifran
Copy link
Contributor

@colifran colifran commented Mar 24, 2024

Reason for this change

SDK v2 and v3 handlers for AwsCustomResource log the event object passed to the handler, API responses, and caught /uncaught errors. This can potentially result in logging sensitive information that a user may wish to hide. This PR introduces a disableLogging flag that can be used to disable all logging configured in the SDK v2 and v3 handlers.

Description of changes

Added a disableLogging flag to the AwsCustomResourceProps interface. The value of disableLogging is provided in the handler event object as a ResourceProperty. All logging is now logged conditionally based on the value of this property.

Description of how you validated changes

  • Existing integ tests have been updated
  • A new integ test with disableLogging set to true was added
  • A unit test was added to check that disableLogging is false by default
  • A unit test was added to check that when disableLogging is true it is set correctly in the synthesized template

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
@aws-cdk-automation aws-cdk-automation requested a review from a team March 24, 2024 22:38
@github-actions github-actions bot added the p2 label Mar 24, 2024
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Mar 24, 2024
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
@colifran colifran changed the title feat: add info and error logging flags to AwsCustomResource feat(custom-resources): add info and error logging flags to AwsCustomResource Mar 25, 2024
colifran and others added 6 commits March 25, 2024 09:48
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
@aws-cdk-automation aws-cdk-automation dismissed their stale review March 26, 2024 04:01

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

Signed-off-by: Francis <colifran@amazon.com>
@colifran colifran changed the title feat(custom-resources): add info and error logging flags to AwsCustomResource feat(custom-resources): add optional logging flag to AwsCustomResource Mar 26, 2024
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
Signed-off-by: Francis <colifran@amazon.com>
@colifran colifran marked this pull request as ready for review March 26, 2024 08:48
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 4f53369
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Mar 26, 2024
@colifran colifran changed the title feat(custom-resources): add optional logging flag to AwsCustomResource feat(custom-resources): add optional logging flag to AwsCustomResourceProps Mar 26, 2024
Copy link
Contributor

@TheRealAmazonKendra TheRealAmazonKendra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is quite what we want here. Please see my comments inline.

/**
* Inputs to configure the Lambda function response.
*/
export interface RespondProps {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export interface RespondProps {
export interface ResponseProps {

responseStatus: string;

/**
*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing docstring. What's reason?

/**
* API response data to include in the response.
*/
data: any;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data doesn't make very clear what this actually is.

*
* @default false
*/
readonly disableLogging?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple things in terms of this prop:

  1. What if we later want to allow for levels of logging or other logging settings? This doesn't really leave room for that possibility.
  2. A field that is defaulted to false and is named for the absence of something isn't typically the best way to name/default things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS. p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants